package com.tz.crm.config;

import com.tz.crm.controller.interceptor.SessionLoginInterceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/*
*
 * Web Security Config
 * = WebMvcConfig + SessionLoginInterceptor
 *
 * @see WebMvcConfig
 * @see SessionLoginInterceptor
 */

@Configuration
@Import(WebMvcConfig.class)
public class WebSecConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private SessionLoginInterceptor sessionLoginInterceptor;



    @Override
    public void addInterceptors(InterceptorRegistry registry) {
             registry.addInterceptor(sessionLoginInterceptor)
                .addPathPatterns("/customer/**", "/contract/**", "/report/**", "/system/**");
    }
}
